s = tf("s");
lowpass_half_hz = 1/(1+s/(0.5*2*pi));
Ts = 1/5000;
lowpass_half_hz_disc = c2d(lowpass_half_hz, Ts);

lowpass_50_hz = 1/(1+s/(50*2*pi));
lowpass_50_hz_disc = c2d(lowpass_50_hz, Ts);

R = 5.1;
L = 2.8E-3;
plant = 1/(L*s+R);

% 设计要求
BW = 2*pi*100;  % 带宽100Hz转换为弧度/秒

% 设计PI控制器
% 使用内模原理，控制器形式为 Kp + Ki/s
Kp = L*BW;      % 比例增益
Ki = R*BW;      % 积分增益

PI_disc = c2d(Kp+Ki/s, Ts);
